
#include "rubbish.h"
#include<QUrl>

Rubbish::Rubbish(QString path,qreal scale)
{
    QPixmap pix(path);//设置初始属性
    this->rubbish=new QGraphicsPixmapItem(pix);
    this->rubbish->setScale(scale);
    this->rubbish->setPos(0,518);
    this->width=pix.width()*scale;
    this->height=pix.height()*scale;

    this->output=new QAudioOutput(this);
    this->getlabel=new QMediaPlayer;
    this->getlabel->setAudioOutput(output);
    this->getlabel->setSource(QUrl("qrc:/resource/getlabel.mp3"));
    this->getlabel->setLoops(1);
}

QRectF Rubbish::boundingRect() const//碰撞体积
{
    return QRectF(this->rubbish->x(),this->rubbish->y(),this->rubbish->x()+this->width,this->rubbish->y()+this->height);
}
